﻿using System;
using System.Collections.Generic;
using System.Data;
using System.Text;
using ReflectionStudio.Core.Events;
namespace WPFExcelReport
{

    public class TECHBSData : BaseFunction
    {


        public TECHBSData()
            : base()
        {

        }

        public TECHBSData(Dictionary<string, object> DicGlobalPara)
            : base(DicGlobalPara)
        {
        }
    
        public DataSet BuildData()
        {
            DataSet setReturn = new DataSet();
            DataSet dsResult = new DataSet();
            try
            {
                orlReadCommand = OracleDB.CreateCommand();
                orlReadCommand.CommandText = "SELECT * FROM SIZING_TECHNOLOGY "
                                ;
                dsResult = Connect2Proxy(orlReadCommand);
                if (dsResult.Tables.Count > 0)
                {
                    dsResult.Tables[0].TableName = "SIZING_TECHNOLOGY";
                }
                byte[] b;
                string value;
                foreach (DataRow dw in dsResult.Tables["SIZING_TECHNOLOGY"].Rows)
                {
                    foreach (DataColumn dc in dsResult.Tables["SIZING_TECHNOLOGY"].Columns)
                    {
                        b = Encoding.GetEncoding("ISO-8859-1").GetBytes(dw[dc.ColumnName].ToString().Trim());
                        value = Encoding.GetEncoding("gb2312").GetString(b);
                        dw[dc.ColumnName] = value; 
                    }
                }
                setReturn.Merge(dsResult);
            }
            catch (Exception ex)
            {
                Tracer.Error(ex.StackTrace, ex);
            }
            return setReturn;
        }
    }
}